﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using VectorDraw.Professional.vdFigures;

namespace MainUI
{
    public partial class vdDocumentControl : RibbonApplicationUserControl
    {
        public vdDocumentControl()
        {
            InitializeComponent();
        }

        private void vdDocumentControl_Load(object sender, EventArgs e)
        {
            this.vdMain.Visible = true;
            this.vdMain.ActiveDocument.Model.BkColorEx = Color.White;
            this.vdMain.ActiveDocument.Model.ShowUCSAxis = false;
            this.vdMain.ActiveDocument.GlobalRenderProperties.SelectingWindowColor = Color.Transparent;
            this.vdMain.ActiveDocument.GlobalRenderProperties.SelectingCrossColor = Color.Transparent;
            //this.vdMain.ActiveDocument.GlobalRenderProperties.RubberBandColor = Color.Tomato;
            this.vdMain.ActiveDocument.GlobalRenderProperties.PickSize = 0;
            this.vdMain.ActiveDocument.GlobalRenderProperties.AxisSize = 0;
            this.vdMain.ActiveDocument.GlobalRenderProperties.CrossSize = 0;
            this.vdMain.ActiveDocument.GlobalRenderProperties.ShowCursor = false;
            this.vdMain.SetCustomMousePointer(Cursors.Default);
            DrawRDW();
        }
        void DrawRDW()
        {
            vdMText mtext = new vdMText();
            mtext.SetUnRegisterDocument(this.vdMain.ActiveDocument);
            mtext.setDocumentDefaults();
            mtext.InsertionPoint = new VectorDraw.Geometry.gPoint(20, -15);
            mtext.HorJustify = VectorDraw.Professional.Constants.VdConstHorJust.VdTextHorCenter;
            mtext.BoxWidth = 100;
            mtext.Height = 10;
            mtext.TextString = "RDW 2014";

            this.vdMain.ActiveDocument.ActiveLayOut.Entities.AddItem(mtext);

            //Zoom in order to see the object.
            this.vdMain.ActiveDocument.ActiveLayOut.ZoomWindow(new VectorDraw.Geometry.gPoint(-100.0, -40.0), new VectorDraw.Geometry.gPoint(140.0, 90.0));
            //Redraw the document to see the above changes.
            this.vdMain.ActiveDocument.Redraw(true);
        }
    }
}
